package com.dwy2002.appointment.listener;

import lombok.Getter;
import org.springframework.boot.context.event.ApplicationStartingEvent;
import org.springframework.context.ApplicationListener;

import java.time.Instant;

/**
 * 用于监听应用启动事件,打印启动时间
 *
 * @author 杜伟毅
 * @version 1.0
 * @since 2025/05/19
 */
@Getter
public class ApplicationStartingEventListener implements ApplicationListener<ApplicationStartingEvent> {

    private long startTime;

    @Override
    public void onApplicationEvent(ApplicationStartingEvent event) {
        startTime = Instant.now().toEpochMilli();
        System.out.println("应用开始启动时间戳：" + startTime);
    }

}
